package androidx.recyclerview.widget;

import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityEvent;
import b.f.l.b0.c;
import b.f.l.b0.d;
import b.f.l.s;
import java.util.Map;
import java.util.WeakHashMap;

public class o extends b.f.l.a {

    /* renamed from: d  reason: collision with root package name */
    final RecyclerView f1026d;
    private final a e;

    public static class a extends b.f.l.a {

        /* renamed from: d  reason: collision with root package name */
        final o f1027d;
        private Map<View, b.f.l.a> e = new WeakHashMap();

        public a(o oVar) {
            this.f1027d = oVar;
        }

        public boolean a(View view, AccessibilityEvent accessibilityEvent) {
            b.f.l.a aVar = this.e.get(view);
            return aVar != null ? aVar.a(view, accessibilityEvent) : super.a(view, accessibilityEvent);
        }

        public d b(View view) {
            b.f.l.a aVar = this.e.get(view);
            return aVar != null ? aVar.b(view) : super.b(view);
        }

        public void f(View view, AccessibilityEvent accessibilityEvent) {
            b.f.l.a aVar = this.e.get(view);
            if (aVar != null) {
                aVar.f(view, accessibilityEvent);
            } else {
                super.f(view, accessibilityEvent);
            }
        }

        public void g(View view, c cVar) {
            if (!this.f1027d.o() && this.f1027d.f1026d.getLayoutManager() != null) {
                this.f1027d.f1026d.getLayoutManager().O0(view, cVar);
                b.f.l.a aVar = this.e.get(view);
                if (aVar != null) {
                    aVar.g(view, cVar);
                    return;
                }
            }
            super.g(view, cVar);
        }

        public void h(View view, AccessibilityEvent accessibilityEvent) {
            b.f.l.a aVar = this.e.get(view);
            if (aVar != null) {
                aVar.h(view, accessibilityEvent);
            } else {
                super.h(view, accessibilityEvent);
            }
        }

        public boolean i(ViewGroup viewGroup, View view, AccessibilityEvent accessibilityEvent) {
            b.f.l.a aVar = this.e.get(viewGroup);
            return aVar != null ? aVar.i(viewGroup, view, accessibilityEvent) : super.i(viewGroup, view, accessibilityEvent);
        }

        public boolean j(View view, int i, Bundle bundle) {
            if (this.f1027d.o() || this.f1027d.f1026d.getLayoutManager() == null) {
                return super.j(view, i, bundle);
            }
            b.f.l.a aVar = this.e.get(view);
            if (aVar != null) {
                if (aVar.j(view, i, bundle)) {
                    return true;
                }
            } else if (super.j(view, i, bundle)) {
                return true;
            }
            return this.f1027d.f1026d.getLayoutManager().i1(view, i, bundle);
        }

        public void l(View view, int i) {
            b.f.l.a aVar = this.e.get(view);
            if (aVar != null) {
                aVar.l(view, i);
            } else {
                super.l(view, i);
            }
        }

        public void m(View view, AccessibilityEvent accessibilityEvent) {
            b.f.l.a aVar = this.e.get(view);
            if (aVar != null) {
                aVar.m(view, accessibilityEvent);
            } else {
                super.m(view, accessibilityEvent);
            }
        }

        /* access modifiers changed from: package-private */
        public b.f.l.a n(View view) {
            return this.e.remove(view);
        }

        /* access modifiers changed from: package-private */
        public void o(View view) {
            b.f.l.a i = s.i(view);
            if (i != null && i != this) {
                this.e.put(view, i);
            }
        }
    }

    public o(RecyclerView recyclerView) {
        this.f1026d = recyclerView;
        b.f.l.a n = n();
        this.e = (n == null || !(n instanceof a)) ? new a(this) : (a) n;
    }

    public void f(View view, AccessibilityEvent accessibilityEvent) {
        super.f(view, accessibilityEvent);
        if ((view instanceof RecyclerView) && !o()) {
            RecyclerView recyclerView = (RecyclerView) view;
            if (recyclerView.getLayoutManager() != null) {
                recyclerView.getLayoutManager().K0(accessibilityEvent);
            }
        }
    }

    public void g(View view, c cVar) {
        super.g(view, cVar);
        if (!o() && this.f1026d.getLayoutManager() != null) {
            this.f1026d.getLayoutManager().M0(cVar);
        }
    }

    public boolean j(View view, int i, Bundle bundle) {
        if (super.j(view, i, bundle)) {
            return true;
        }
        if (o() || this.f1026d.getLayoutManager() == null) {
            return false;
        }
        return this.f1026d.getLayoutManager().g1(i, bundle);
    }

    public b.f.l.a n() {
        return this.e;
    }

    /* access modifiers changed from: package-private */
    public boolean o() {
        return this.f1026d.hasPendingAdapterUpdates();
    }
}
